package com.metaera.app.controller.presenter;

import com.metaera.app.controller.core.RequestPresenter;
import com.metaera.app.controller.view.core.INetworkRequestView;
import com.metaera.app.data.DataRepository;

import com.metaera.app.data.rx.ResponseObserver;
import com.metaera.app.data.rx.SchedulersTransformer;


public class FeedbackPresenter extends RequestPresenter<INetworkRequestView<Object>> {

    public void submit(int type, CharSequence content, CharSequence name, CharSequence contact){

        DataRepository.getInstance()
                .submitFeedback(
                        type,
                        content.toString(),
                        name.toString(),
                        contact.toString()
                )
                .compose(SchedulersTransformer.transformer())
                .subscribe(new ResponseObserver<>(
                                this,
                                mView,
                                response -> mView.successful(response.getData())
                        )
                );
    }

}
